package api

import (
	"github.com/gin-gonic/gin"
	"live-broadcast/api/handler"
	"live-broadcast/api/maddleware"
	"live-broadcast/pkg/jwt"
)

func Router(r *gin.Engine) {
	r.Use(maddleware.Url())
	api := r.Group("api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.Register)
			user.POST("/login", handler.Login)
		}
		live_broadcast := api.Group("live_broadcast")
		{
			live_broadcast.Use(jwt.JWTAuth(handler.JWT_USER_DON))
			live_broadcast.POST("/add", handler.Add)
			live_broadcast.POST("/upload", handler.Upload)
			live_broadcast.POST("/addUser", handler.AddUser)
			live_broadcast.POST("/updated", handler.Updated)
			live_broadcast.GET("/List", handler.List)
			live_broadcast.POST("/ListRoom", handler.ListRoom)
		}
	}
}
